﻿Option Explicit On
Option Strict On

Imports System.Windows.Forms.Form
Imports asWins.Forms.asMdiManager
Imports System.Globalization
Imports System.Resources
Imports FRAMEWORK.Framework
Imports System.Data.SqlClient

Public Class frmMain

    'Global Variable
    Dim f As Windows.Forms.Form
#Region " Function and Procedure "

#End Region

    Private Sub tsWorkSize_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsWorkSize.Click
        If (Me.AsMdiManager1.FormExists("frm_WorkSize")) Then
            AsMdiManager1.SetActive("frm_WorkSize")
        Else
            Dim frm As frm_WorkSize = New frm_WorkSize
            Me.AsMdiManager1.AddForm(frm)
        End If
    End Sub

    Private Sub tsCustomer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsCustomer.Click
        If (Me.AsMdiManager1.FormExists("frm_Customer")) Then
            AsMdiManager1.SetActive("frm_Customer")
        Else
            Dim frm As frm_Customer = New frm_Customer
            Me.AsMdiManager1.AddForm(frm)
        End If
    End Sub

    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TMP_DATE_AT_SERVER = FRAMEWORK.Framework.CLASSDATE.GETDATEATSERVER 'ดึงวันจากเครื่อง server
        'Me.tsDate.Text = "  Date :   " & Date.Now.ToString("dd MMM yyyy")
        'Me.lblTime.Text = "  Time :   " & Date.Now.ToString("hh:mm:ss tt")
    End Sub

    Private Sub tsPaperSize_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsPaperSize.Click
        If (Me.AsMdiManager1.FormExists("frm_PaperSize")) Then
            AsMdiManager1.SetActive("frm_PaperSize")
        Else
            Dim frm As frm_PaperSize = New frm_PaperSize
            Me.AsMdiManager1.AddForm(frm)
        End If
    End Sub

    Private Sub tsLacker_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsLacker.Click
        If (Me.AsMdiManager1.FormExists("frm_Lacker")) Then
            AsMdiManager1.SetActive("frm_Lacker")
        Else
            Dim frm As frm_Lacker = New frm_Lacker
            Me.AsMdiManager1.AddForm(frm)
        End If
    End Sub

    Private Sub tsPacking_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsPacking.Click
        If (Me.AsMdiManager1.FormExists("frm_Packing")) Then
            AsMdiManager1.SetActive("frm_Packing")
        Else
            Dim frm As frm_Packing = New frm_Packing
            Me.AsMdiManager1.AddForm(frm)
        End If
    End Sub

    Private Sub tsListing_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsListing.Click
        If (Me.AsMdiManager1.FormExists("frm_Listing")) Then
            AsMdiManager1.SetActive("frm_Listing")
        Else
            Dim frm As frm_Listing = New frm_Listing
            Me.AsMdiManager1.AddForm(frm)
        End If
    End Sub

    Private Sub tsPaperType_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsPaperType.Click
        If (Me.AsMdiManager1.FormExists("frm_PaperType")) Then
            AsMdiManager1.SetActive("frm_PaperType")
        Else
            Dim frm As frm_PaperType = New frm_PaperType
            Me.AsMdiManager1.AddForm(frm)
        End If
    End Sub

    Private Sub tsGram_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsGram.Click
        If (Me.AsMdiManager1.FormExists("frm_Gram")) Then
            AsMdiManager1.SetActive("frm_Gram")
        Else
            Dim frm As frm_Gram = New frm_Gram
            Me.AsMdiManager1.AddForm(frm)
        End If
    End Sub

    Private Sub tsPrintSystem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsPrintSystem.Click
        If (Me.AsMdiManager1.FormExists("frm_PrintSystem")) Then
            AsMdiManager1.SetActive("frm_PrintSystem")
        Else
            Dim frm As frm_PrintSystem = New frm_PrintSystem
            Me.AsMdiManager1.AddForm(frm)
        End If
    End Sub

    Private Sub tsColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If (Me.AsMdiManager1.FormExists("frm_Color")) Then
            AsMdiManager1.SetActive("frm_Color")
        Else
            Dim frm As frm_Color = New frm_Color
            Me.AsMdiManager1.AddForm(frm)
        End If
    End Sub

    Private Sub tsDepartment_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsDepartment.Click
        If (Me.AsMdiManager1.FormExists("frm_Department")) Then
            AsMdiManager1.SetActive("frm_Department")
        Else
            Dim frm As frm_Department = New frm_Department
            Me.AsMdiManager1.AddForm(frm)
        End If
    End Sub

    Private Sub tsOrder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsOrder.Click
        If (Me.AsMdiManager1.FormExists("frm_JobOrder")) Then
            AsMdiManager1.SetActive("frm_JobOrder")
        Else
            Dim frm As frm_JobOrder = New frm_JobOrder
            Me.AsMdiManager1.AddForm(frm)
        End If
    End Sub

    Private Sub tsStatus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsStatus.Click
        If (Me.AsMdiManager1.FormExists("frm_Status")) Then
            AsMdiManager1.SetActive("frm_Status")
        Else
            Dim frm As frm_Status = New frm_Status
            Me.AsMdiManager1.AddForm(frm)
        End If
    End Sub

    Private Sub tsEmployee_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsEmployee.Click
        If (Me.AsMdiManager1.FormExists("frm_Employee")) Then
            AsMdiManager1.SetActive("frm_Employee")
        Else
            Dim frm As frm_Employee = New frm_Employee
            Me.AsMdiManager1.AddForm(frm)
        End If
    End Sub

    Private Sub tsCompany_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsCompany.Click
        If (Me.AsMdiManager1.FormExists("frm_Company")) Then
            AsMdiManager1.SetActive("frm_Company")
        Else
            Dim frm As frm_Company = New frm_Company
            Me.AsMdiManager1.AddForm(frm)
        End If
    End Sub

    Private Sub tsUserAccount_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsUserAccount.Click
        If (Me.AsMdiManager1.FormExists("frm_UserPermission")) Then
            AsMdiManager1.SetActive("frm_UserPermission")
        Else
            Dim frm As frm_UserPermission = New frm_UserPermission
            Me.AsMdiManager1.AddForm(frm)
        End If
    End Sub

    Private Sub tsBankList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsBankList.Click
        If (Me.AsMdiManager1.FormExists("frm_BankList")) Then
            AsMdiManager1.SetActive("frm_BankList")
        Else
            Dim frm As frm_BankList = New frm_BankList
            Me.AsMdiManager1.AddForm(frm)
        End If
    End Sub

    Private Sub tsReceipt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsReceipt.Click
        If (Me.AsMdiManager1.FormExists("frm_ReceiptMoney")) Then
            AsMdiManager1.SetActive("frm_ReceiptMoney")
        Else
            Dim frm As frm_ReceiptMoney = New frm_ReceiptMoney
            Me.AsMdiManager1.AddForm(frm)
        End If
    End Sub
End Class